/**
 * Created by Seven on 2020/5/19.
 */
var helper = require("../../javascript/helper");
var db = require("../../javascript/mysql");
var mysql = new db.mysqlClient("accident");






function genProductInfo() {
    plan = {
        "planA": {
            "year": ["23-50"],
            "days": ["3d"],
            "people_count": ["1"],
            "accident_death": ["300000"],
            "accident_disable": ["300000"],
            "acute_death": ["300000"],
            "price": ["2.98"]
        },
        "planB": {
            "year": ["23-50"],
            "days": ["5d"],
            "people_count": ["1"],
            "accident_death": ["300000"],
            "accident_disable": ["300000"],
            "acute_death": ["300000"],
            "price": ["4.98"]

        },
        "planC": {
            "year": ["23-50"],
            "days": ["10d"],
            "people_count": ["1"],
            "accident_death": ["300000"],
            "accident_disable": ["300000"],
            "acute_death": ["300000"],
            "price": ["9.98"]

        }
    };
    for (k in plan) {
        data = helper.product([plan[k]["year"], plan[k]["days"], plan[k]["people_count"], plan[k]["accident_death"], plan[k]["accident_disable"], plan[k]["acute_death"], plan[k]["price"]])
        for (i = 0; i < data.length; i++) {
            dt = helper.formatProductInfo(data[i], plan[k]);
            dt.name = "畅游九州-百年境内旅游险";
            dt.company = "百年人寿";
            mysql.insertData( dt );
        }
    }

}
genProductInfo();
mysql.close();